import type { Directive, DirectiveBinding } from "vue";
interface ElType extends HTMLElement {
    copyData: string | number;
    __handleClick__: any;
}
import store from '@/store'
import { Session } from "@/utils/storage";

const hasRole: Directive = {
    mounted(el: ElType, binding: DirectiveBinding) {
        const { value } = binding;
        const redisUserInfo = Session.get('userInfo') ?? {}
        const result = redisUserInfo.roleList?.some((l: any) => value.includes(l.roleKey))
        console.log('权限====>', value, result);
        result && (el.style.display = "");
        !result && (el.style.display = "none");
    },
};
export default hasRole